local nya__play = fk.CreateSkill {

  name = "nya__play",

  tags = {  },

}



nya__play:addEffect(fk.EventPhaseStart, {
  name = "nya__play",
  anim_type = "special",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(nya__play.name) and
      (player.phase == Player.Start or player.phase == Player.Finish) and not player:isNude()
  end,
  on_cost = function(self, event, target, player, data)
    if player.phase == Player.Start then
      local to, card =  player.room:askForChooseCardAndPlayers(player, table.map(player.room:getOtherPlayers(player), function(p)
        return p.id end), 1, 1, ".", "#nya__play-choose", nya__play.name, true)
      if #to > 0 and card then
        event:setCostData(self, {to[1], card})
        return true
      end
    else
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if player.phase == Player.Start then
      room:throwCard(event:getCostData(self)[2], nya__play.name, player, player)
      room:handleAddLoseSkills(player, "-nya__play", nil, true, false)
      local to = room:getPlayerById(event:getCostData(self)[1])
      if not to.dead then
        room:handleAddLoseSkills(to, "nya__play", nil, true, false)
        to:drawCards(1, nya__play.name)
      end
    else
      room:askForDiscard(player, 1, 1, true, nya__play.name, false)
    end
  end,
})
nya__play:addEffect(fk.EventAcquireSkill, {
  refresh_events = {fk.EventAcquireSkill,fk.EventLoseSkill},
  can_refresh = function (self, event, target, player, data)
    return target == player and data == self
  end,
  on_refresh = function (self, event, target, player, data)
    if player:hasSkill(self,true) then
      player.room:setPlayerMark(player,"@@nya__play",1)
    else
      player.room:setPlayerMark(player,"@@nya__play",0)
    end
  end,
})
nya__play:addEffect(fk.EventLoseSkill, {
  refresh_events = {fk.EventAcquireSkill,fk.EventLoseSkill},
  can_refresh = function (self, event, target, player, data)
    return target == player and data == self
  end,
  on_refresh = function (self, event, target, player, data)
    if player:hasSkill(self,true) then
      player.room:setPlayerMark(player,"@@nya__play",1)
    else
      player.room:setPlayerMark(player,"@@nya__play",0)
    end
  end,
})

return nya__play